$(document).ready(function () {
   $("#form-forget-password").bootstrapValidator({
       // container:"tooltip",
       feedbackIcons: {
            valid: null,
            invalid: null,
            validating: null
        },
       live:"enabled",
       excluded: [':disabled', ':hidden', ':not(:visible)'],//排除无需验证的控件，比如被禁用的或者被隐藏的
       message:gettext("There was an error in the input！"),
       submitButtons:"[type='submit']",
       fields:{
           phone:{
                validators:{
                   notEmpty:{
                        message:gettext("Phone number can not be blank!")
                    },
                    phone:{
                        country:'CN',
                        message:gettext("Phone number format is invalid！")
                    }
                }
           },
           password_1:{
                validators:{
                    notEmpty:{
                        message:gettext("password can not be blank！")
                    },
                    stringLength: {
                      min: 6,
                      max: 19,
                      message: gettext('The user confirms that the password length is greater than 5 and less than 20!')
                    }
                }
           },
           password_2:{
                validators:{
                    identical: {
                      field: 'password_1',
                      message: gettext('The user\'s new password and confirmation password are inconsistent!')
                    },
                    notEmpty:{
                        message: gettext("password can not be blank！")
                    },
                    stringLength: {
                      min: 6,
                      max: 19,
                      message: gettext('The user confirms that the password length is greater than 5 and less than 20!')
                    }
                }
           },
           code:{
               validators:{
                    notEmpty:{
                        message:gettext("SMS verification cannot be empty！")
                    },
                    stringLength: {
                      min: 6,
                      max: 6,
                      message: gettext('SMS verification code is 6 digits long')
                    }
                }
           }
       }
   })
});